import type { UploadUserFile } from "element-plus";

export interface GetSpuListApiParams {
  page: number;
  limit: number;
  category3Id: number;
}

export interface SpuItem {
  id?: number;
  spuName: string;
  description: string;
  category3Id?: number;
  tmId?: number;
}

export interface SpuSaleAttrValueItem {
  saleAttrName?: string;
  saleAttrValueName: string;
  baseSaleAttrId: number;
  id?: number;
  isChecked?: string;
  spuId?: number;
}
export type SpuSaleAttrValueList = SpuSaleAttrValueItem[];

export interface SpuSaleAttrItem {
  baseSaleAttrId: number;
  saleAttrName: string;
  isShowEdit: boolean;
  id?: number;
  spuId?: number;
  spuSaleAttrValueList: SpuSaleAttrValueList;
}
export type SpuSaleAttrList = SpuSaleAttrItem[];

export interface SpuFormData extends SpuItem {
  spuImageList: UploadUserFile[];
  spuSaleAttrList: SpuSaleAttrList;
}
export interface AddOrUpdateSpuParams extends SpuItem {
  spuImageList: SpuImageList;
  spuSaleAttrList: SpuSaleAttrList;
}

export type SpuList = SpuItem[];

export interface SpuImageItem {
  imgName: string;
  imgUrl: string;
  id?: number;
  spuId?: number;
  isDefault?: "0" | "1";
}
export type SpuImageList = SpuImageItem[];

export interface GetSpuListApiResponse {
  records: SpuList;
  total: number;
}

export interface BaseSaleAttrItem {
  id: number;
  name: string;
}

export type BaseSaleAttrList = BaseSaleAttrItem[];
